package com.htudata.zabbix.base.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;

@Service
public class ZabbixBaseService {

  public static JSONArray idsToIdObjs(JSONArray jsonArray, String idField) {
    JSONArray result = new JSONArray();
    JSONObject jsonObject = null;
    String id = "";
    for (Object obj : jsonArray) {
      id = obj + "";
      jsonObject = new JSONObject();
      jsonObject.put(idField, id);
      result.add(jsonObject);
    } 
    return result;
  }
}
